<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
	<head>
		<base href="<%=basePath%>">
		<title>上传资源</title>
		
		<link rel="stylesheet" type="text/css" href="pages/system/resource/css/upresource.css">
		<script type="text/javascript" src="pages/system/resource/js/upresource.js"></script>
	</head>
	
	<body>
		<div class="row">
			<div class="col-xs-12">
		        <div class="card">
		            <div class="card-header">
		                <div class="card-title">
		                    <div class="title">资源上传表单</div>
		                </div>
		            </div>
		            <div class="card-body no-padding">
                        <div role="tabpanel">
                            <!-- Nav tabs -->
                            <ul class="nav nav-tabs" role="tablist">
                                <li role="presentation" class="active">
                                	<a href="#upload" aria-controls="upload" role="tab" data-toggle="tab">上传资源</a>
                                </li>
                                <li role="presentation">
                                	<a href="#save" aria-controls="save" role="tab" data-toggle="tab">保存链接</a>
                                </li>
                            </ul>
                            <!-- Tab panes -->
                            <div id="tabContent" class="tab-content">
                                <div role="tabpanel" class="tab-pane active" id="upload">
                                	<div class="form-horizontal">
					                    <div class="form-group">
					                        <label for="resource" class="col-sm-2 control-label">资源上传</label>
					                        <div class="col-sm-8">
					                            <input type="file" class="form-control" id="resource" name="resource" />
					                        </div>
									    	<label id="resource-label" class="col-md-2 info-label"><code>*文件大小不能超过10MB*</code></label>
					                    </div>
					                    <div class="form-group">
					                        <label for="introduction" class="col-sm-2 control-label">资源介绍</label>
					                        <div class="col-sm-8">
					                            <textarea class="form-control" rows="5" id="introduction" name="introduction" placeholder="请输入资源介绍，不少于20字，不超过255字。" ></textarea>
					                        </div>
									    	<label id="introduction-label" class="col-md-2 info-label"><code></code></label>
					                    </div>
					                    <div class="form-group">
					                        <label for="words" class="col-sm-2 control-label">关键词</label>
					                        <div class="col-sm-8 searchWordsGroup">
					                            <input type="text" class="form-control" id="words" name="words" placeholder="请输入查询关键词，多个关键词以分号(;)隔开。" />
					                        	<div v-if="result!=null && result.length>0">
					                        		<button type="button" class="btn btn-info btn-sm" v-for="label in result" @click="clickBtn(label.label)">{{label.label}}</button>
					                        	</div>
					                        </div>
									    	<label id="words-label" class="col-md-2 info-label"><code></code></label>
					                    </div>
					                    <div class="form-group">
					                        <label for="maxNum" class="col-sm-2 control-label">阅后即焚次数</label>
					                        <div class="col-sm-8">
					                            <input type="number" maxlength="10" class="form-control" id="maxNum" name="maxNum" placeholder="请输入最多允许下载或阅读次数，达到次数后自动删除资源文件" />
					                        </div>
									    	<label id="maxNum-label" class="col-md-2 info-label"><code></code></label>
					                    </div>
					                    <div class="form-group">
					                        <div class="col-sm-offset-2 col-sm-8">
					                            <button @click="submitResource" type="button" class="btn btn-success btn-lg" style="width: 100%;">提交</button>
					                        </div>
					                    </div>
					                </div>
                                </div>
                                <div role="tabpanel" class="tab-pane" id="save">
                                	<div class="form-horizontal">
					                    <div class="form-group">
					                        <label for="resourceName" class="col-sm-2 control-label">资源名称</label>
					                        <div class="col-sm-8">
					                            <input type="text" class="form-control" id="resourceName" name="resourceName" placeholder="请输入资源名称" />
					                        </div>
									    	<label id="resourceName-label" class="col-md-2 info-label"></label>
					                    </div>
					                    <div class="form-group">
					                        <label for="resourcePath" class="col-sm-2 control-label">资源地址</label>
					                        <div class="col-sm-8">
					                            <input type="text" class="form-control" id="resourcePath" name="resourcePath" placeholder="请输入资源地址" />
					                        </div>
									    	<label id="resourcePath-label" class="col-md-2 info-label"><code></code></label>
					                    </div>
					                    <div class="form-group">
					                        <label for="resourceIntroduction" class="col-sm-2 control-label">资源介绍</label>
					                        <div class="col-sm-8">
					                            <textarea class="form-control" rows="5" id="resourceIntroduction" name="resourceIntroduction" placeholder="请输入资源介绍，不少于20字，不超过255字。" ></textarea>
					                        </div>
									    	<label id="resourceIntroduction-label" class="col-md-2 info-label"><code></code></label>
					                    </div>
					                    <div class="form-group">
					                        <label for="resourceWords" class="col-sm-2 control-label">关键词</label>
					                        <div class="col-sm-8 searchWordsGroup">
					                            <input type="text" class="form-control" id="resourceWords" name="resourceWords" placeholder="请输入查询关键词，多个关键词以分号(;)隔开。" />
					                        	<div v-if="result!=null && result.length>0">
					                        		<button type="button" class="btn btn-info btn-sm" v-for="label in result" @click="clickBtn1(label.label)">{{label.label}}</button>
					                        	</div>
					                        </div>
									    	<label id="resourceWords-label" class="col-md-2 info-label"><code></code></label>
					                    </div>
					                    <div class="form-group">
					                        <label for="maxReadNum" class="col-sm-2 control-label">阅后即焚次数</label>
					                        <div class="col-sm-8">
					                            <input type="number" maxlength="10" class="form-control" id="maxReadNum" name="maxReadNum" placeholder="请输入最多允许下载或阅读次数，达到次数后自动删除资源文件" />
					                        </div>
									    	<label id="maxReadNum-label" class="col-md-2 info-label"><code></code></label>
					                    </div>
					                    <div class="form-group">
					                        <div class="col-sm-offset-2 col-sm-8">
					                            <button @click="saveResource" type="button" class="btn btn-success btn-lg" style="width: 100%;">提交</button>
					                        </div>
					                    </div>
					                </div>
                                </div>
                            </div>
                        </div>
                    </div>
		        </div>
		    </div>
	    </div>
	</body>
</html>